#include <bits/stdc++.h>
using namespace std;
int du[200005];
int fa[200005];

void init(int n) {
  for (int i = 1; i <= n; i++) {
    fa[i] = i;
  }
}

int find(int x) {
  if (x == fa[x]) {
    return x;
  } else {
    fa[x] = find(fa[x]);
    return fa[x];
  }
}
void uion(int x, int y) {
  int fx = find(x);
  int fy = find(y);
  if (fx != fy) {
    fa[fx] = fy;
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  init(n);
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    du[u]++;
    du[v]++;
    uion(u, v);
  }
  for (int i = 1; i <= n; i++) {
    if (du[i] != 2) {
      cout << "No" << endl;
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (find(i) != find(1)) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}